<?php

function dbconnect() 
	{ 
		require('config.php'); 
		static $connect = null; 
		if ($connect === null) 
			{
				 $connect =  mysql_connect($host, $user, $passwd) or die(mysql_error());
				 mysql_query("SET character_set_results=utf8", $connect);
				 mysql_select_db($database); 
			} 
		return $connect; 
	} 

function getbyid_binhluanbv($id)
	{
		$result= mysql_query("SELECT * FROM Binh_luan_bai_viet WHERE ID=N'".$id."'",dbconnect());
		return mysql_fetch_array($result); 
	}
	
function update_binhluanbv($post)
	{
	$query= mysql_query("UPDATE Binh_luan_bai_viet 
	SET Ten=N'".$post['Ten']."', 
	Email=N'".$post['Email']."',
	Noi_dung=N'".$post['Noi_dung']."', 
	Trang_thai=N'".$post['Trang_thai']."' WHERE ID=N'".$post['ID']."' ",dbconnect()); 	
	}
	
	
	
	function getbyid_binhluansach($id)
	{
		$result= mysql_query("SELECT * FROM binh_luan_sach WHERE ID=N'".$id."'",dbconnect());
		return mysql_fetch_array($result); 
	}
	
	
	function update_binhluansach($post)
	{
	$query= mysql_query("UPDATE binh_luan_sach
	SET Ten=N'".$post['Ten']."', 
	Email=N'".$post['Email']."',
	Noi_dung=N'".$post['Noi_dung']."', 
	Trang_thai=N'".$post['Trang_thai']."' WHERE ID=N'".$post['ID']."' ",dbconnect()); 	
	}
	
?>